﻿using System.Net;

namespace BToolkit
{
    public class NetworkHelper
    {
        /// <summary>
        /// 获取内网IP
        /// </summary>
        public static string GetInternalIP()
        {
            IPHostEntry host = Dns.GetHostEntry(Dns.GetHostName());
            foreach (IPAddress ip in host.AddressList)
            {
                if (ip.AddressFamily.ToString() == "InterNetwork")
                {
                    return ip.ToString();
                }
            }
            return null;
        }

    }
}
